package com.study.test.page;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.*;

public class PageFuture {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        test11();
    }

    private static void test11() throws ExecutionException, InterruptedException {
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(2, 6, 100, TimeUnit.MILLISECONDS, new ArrayBlockingQueue(20000));
        Future<List<String>> list1 = threadPoolExecutor.submit(() -> {
            List<String> strings = new ArrayList<>();
            strings.add("11");
            return strings;

        });
        Future<List<String>> list2 = threadPoolExecutor.submit(() -> {
            List<String> strings = new ArrayList<>();
            strings.add("22");
            return strings;
        });
        List<String> strings = new ArrayList<>();
        List<String> stringGet1 = list1.get();
        List<String> stringGet2 = list2.get();
        strings.addAll(stringGet1);
        strings.addAll(stringGet2);
        System.out.println(strings);
    }
}
